﻿using ESRI.ArcGIS.Carto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PlanningGIS.ArcGIS
{
    /// <summary>
    /// Element对象方法扩展
    /// </summary>
    public static  class ElementExtension
    {
        /// <summary>
        /// 设置Element对象的名称和属性
        /// </summary>
        /// <param name="element">Element对象</param>
        /// <param name="name">名称</param>
        /// <param name="property">自定义属性</param>
        /// <param name="anchor">定位点位置</param>
        public static void SetCustomProperty(this IElement element, string name = "", object property = null, esriAnchorPointEnum anchor = esriAnchorPointEnum.esriCenterPoint)
        {
            IElementProperties3 elePro = element as IElementProperties3;
            elePro.AnchorPoint = esriAnchorPointEnum.esriCenterPoint;
            elePro.AutoTransform = true;
            elePro.Name = name;
            elePro.CustomProperty = property;
        }
    }
}
